﻿<Controls:MetroWindow x:Class="NOnkyo.WpfGui.Views.RemoteView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:vm="clr-namespace:NOnkyo.WpfGui.ViewModels"
        xmlns:properties="clr-namespace:NOnkyo.WpfGui.AttachedProperty"
        xmlns:my="clr-namespace:NOnkyo.WpfGui.Views"
        xmlns:conv="clr-namespace:NOnkyo.WpfGui.Converter"
        properties:CloseDialog.DialogResult="{Binding IsDialogClose}"
        Closed="Window_Closed"
        Title="Remote-Control" Height="650" Width="550" ShowIconOnTitleBar="True" WindowStartupLocation="CenterScreen" >

    <Window.Resources>
        <Storyboard x:Key="AlbumImageStoryboard">
            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="imgAlbum" Storyboard.TargetProperty="Visibility">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
            </ObjectAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="imgAlbum">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.5"/>
                <EasingDoubleKeyFrame KeyTime="0:0:2" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="imgAlbum">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.5"/>
                <EasingDoubleKeyFrame KeyTime="0:0:2" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="imgAlbum">
                <EasingDoubleKeyFrame KeyTime="0" Value="-180"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="-90"/>
                <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </Window.Resources>

    <Window.DataContext>
        <vm:RemoteViewModel/>
    </Window.DataContext>

    <Controls:MetroWindow.Flyouts>
        <Controls:Flyout x:Name="ReceiverFlyout" Header="Receiver" Background="#9f000000" Position="Right" >
            <StackPanel Orientation="Vertical">
                <StackPanel.Resources>
                    <Style TargetType="Button" BasedOn="{StaticResource StandardButton}">
                        <Setter Property="Margin" Value="3,3,3,0"/>
                        <Setter Property="Height" Value="30"/>
                        <Setter Property="Width" Value="60"/>
                    </Style>
                </StackPanel.Resources>
                <TextBlock Text="Zone Selectors" HorizontalAlignment="Center"/>
                <Separator />
                <Grid Margin="5,0,5,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <RadioButton Grid.Column="0" GroupName="Zone" Content="Zone1" IsChecked="{Binding Path=CurrentZone, Mode=TwoWay, Converter={StaticResource enumTobool}, ConverterParameter=Zone1}"/>
                    <RadioButton Grid.Column="1" GroupName="Zone" Content="Zone2" IsChecked="{Binding Path=CurrentZone, Mode=TwoWay, Converter={StaticResource enumTobool}, ConverterParameter=Zone2}" HorizontalAlignment="Center"/>
                    <RadioButton Grid.Column="2" GroupName="Zone" Content="Zone3" IsChecked="{Binding Path=CurrentZone, Mode=TwoWay, Converter={StaticResource enumTobool}, ConverterParameter=Zone3}"/>
                </Grid>
                <TextBlock Margin="0,10,0,0" Text="Input Selectors" HorizontalAlignment="Center"/>
                <Separator />
                <Grid HorizontalAlignment="Center" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Button Grid.Row="0" Grid.Column="0" Content="BD/DVD" 
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="BDDVD"/>
                    <Button Grid.Row="1" Grid.Column="0" Content="VCR/DVR"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="VIDEO1"/>
                    <Button Grid.Row="2" Grid.Column="0" Content="CBL/SAT"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="VIDEO2"/>
                    <Button Grid.Row="3" Grid.Column="0" Content="GAME/TV"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="VIDEO3"/>
                    <Button Grid.Row="4" Grid.Column="0" Content="DLNA"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="MUSICSERVER"/>
                    <Button Grid.Row="5" Grid.Column="0" Content="iRadio"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="INTERNETRADIO"/>
                    <Button Grid.Row="6" Grid.Column="0" Content="PC"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="VIDEO6"/>
                    <Button Grid.Row="0" Grid.Column="1" Content="AUX1"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="VIDEO4"/>
                    <Button Grid.Row="1" Grid.Column="1" Content="AUX2"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="VIDEO5"/>
                    <Button Grid.Row="2" Grid.Column="1" Content="TUNER"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="TUNER"/>
                    <Button Grid.Row="3" Grid.Column="1" Content="TV/CD"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="TVCD"/>
                    <Button Grid.Row="4" Grid.Column="1" Content="PHONO"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="PHONO"/>
                    <Button Grid.Row="5" Grid.Column="1" Content="NET"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="NETWORKNET"/>
                    <Button Grid.Row="6" Grid.Column="1" Content="USB"
                    Command="{Binding Path=InputSelectorCommand}"
                    CommandParameter="USB"/>
                </Grid>

                <TextBlock Margin="0,10,0,0" Text="Input Selectors (Direct)" HorizontalAlignment="Center"/>
                <Separator />
                <ComboBox x:Name="cboInputSelectors" Margin="3,0" Background="#02FFFFFF" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" 
                    ItemsSource="{Binding Path=InputSelectorItems}" DisplayMemberPath="DisplayName" SelectedValuePath="Value" SelectedValue="{Binding Path=CurrentInputSelectorCboEntry}" />

                <TextBlock Margin="0,10,0,0" Text="Listening Mode" HorizontalAlignment="Center"/>
                <Separator />
                <StackPanel Orientation="Horizontal">
                    <Button Content="MOVIE" Command="{Binding Path=ListeningModeMovieUPCommand}"/>
                    <Button Content="MUSIC" Command="{Binding Path=ListeningModeMusicUPCommand}"/>
                    <Button Content="GAME" Command="{Binding Path=ListeningModeGameUPCommand}"/>
                </StackPanel>

                <TextBlock Margin="0,10,0,0" Text="Listening Mode (Direct)" HorizontalAlignment="Center"/>
                <Separator />
                <ComboBox x:Name="cboListeningMode" Margin="3,0" Background="#02FFFFFF" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" 
                    ItemsSource="{Binding Path=ListeningModeItems}" DisplayMemberPath="DisplayName" SelectedValuePath="Value" SelectedValue="{Binding Path=CurrentListeningModeCboEntry}" />
            </StackPanel>
        </Controls:Flyout>
        <Controls:Flyout x:Name="SettingsFlyout" Header="Settings" Background="#9f000000" Position="Left" >
            <StackPanel>
                <StackPanel.Resources>
                    <Style TargetType="Button" BasedOn="{StaticResource MetroCircleButtonStyle}">
                        <Setter Property="Height" Value="40"/>
                        <Setter Property="Width" Value="40"/>
                        <Setter Property="VerticalAlignment" Value="Center"/>
                        <Setter Property="FontSize" Value="16"/>
                    </Style>
                </StackPanel.Resources>
                <TextBlock Text="Treble" HorizontalAlignment="Center"/>
                <Separator />
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <Button Grid.Column="0" 
                                Command="{Binding TrebleDownCommand}" Content="-" IsEnabled="{Binding Path=ViewCanTrebleDown}"/>
                    <Label  Grid.Column="1" Content="{Binding Path=TrebleDisplay}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    <Button Grid.Column="2" 
                                Command="{Binding TrebleUpCommand}" Content="+" IsEnabled="{Binding Path=ViewCanTrebleUp}"/>
                </Grid>
                <TextBlock Margin="0,5,0,0" Text="Bass" HorizontalAlignment="Center"/>
                <Separator />
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <Button Grid.Column="0" 
                                Command="{Binding BassDownCommand}" Content="-" IsEnabled="{Binding Path=ViewCanBassDown}"/>
                    <Label Grid.Column="1" Content="{Binding Path=BassDisplay}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    <Button Grid.Column="2" 
                                Command="{Binding BassUpCommand}" Content="+" IsEnabled="{Binding Path=ViewCanBassUp}"/>
                </Grid>
                <TextBlock Margin="0,5,0,0" Text="Center Level" HorizontalAlignment="Center"/>
                <Separator />
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <Button Grid.Column="0" 
                                Command="{Binding CenterLevelDownCommand}" Content="-" IsEnabled="{Binding Path=ViewCanCenterLevelDown}"/>
                    <Label Grid.Column="1" Content="{Binding Path=CenterLevelDisplay}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    <Button Grid.Column="2" 
                                Command="{Binding CenterLevelUpCommand}" Content="+" IsEnabled="{Binding Path=ViewCanCenterLevelUp}"/>
                </Grid>
                <TextBlock Margin="0,5,0,0" Text="Subwoofer Level" HorizontalAlignment="Center"/>
                <Separator />
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <Button Grid.Column="0" 
                                Command="{Binding SubwooferLevelDownCommand}" Content="-" IsEnabled="{Binding Path=ViewCanSubwooferLevelDown}"/>
                    <Label Grid.Column="1" Content="{Binding Path=SubwooferLevelDisplay}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    <Button Grid.Column="2" 
                                Command="{Binding SubwooferLevelUpCommand}" Content="+" IsEnabled="{Binding Path=ViewCanSubwooferLevelUp}"/>
                </Grid>
                <TextBlock Margin="0,5,0,0" Text="{Binding Path=DimmerDisplay}" HorizontalAlignment="Center"/>
                <Separator />
                <Button Margin="10" Content="Change" Style="{DynamicResource SquareButtonStyle}" Command="{Binding Path=DimmerChangeCommand}"/>
            </StackPanel>
        </Controls:Flyout>
    </Controls:MetroWindow.Flyouts>

    <DockPanel LastChildFill="True">
        <DockPanel DockPanel.Dock="Bottom">
            <TextBlock Margin="3" Text="{Binding ConnectState}"></TextBlock>
            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
                <TextBlock Margin="3" Text="Server"></TextBlock>
                <Ellipse x:Name="cirServerState" Margin="3" Fill="Red" Width="10" Height="10" Opacity="0.8">
                </Ellipse>
                <TextBlock Margin="5">
                <Hyperlink NavigateUri="{Binding WebSetupUrl}" RequestNavigate="Hyperlink_RequestNavigate">Onkyo Setup</Hyperlink>
                </TextBlock>
            </StackPanel>
        </DockPanel>

        <StackPanel  DockPanel.Dock="Left">
            <StackPanel>
                <Button Style="{DynamicResource MetroCircleButtonStyle}"
            		Height="55"
            		Width="55"
            		VerticalAlignment="Center" Command="{Binding PowerCommand}">
                    <Rectangle Width="20" Height="20">
                        <Rectangle.Fill>
                            <VisualBrush x:Name="bruPower" Stretch="Fill" Visual="{StaticResource appbar_power_on}"/>
                        </Rectangle.Fill>
                    </Rectangle>
                </Button>
                <Label Content="Power" HorizontalAlignment="Center"/>
            </StackPanel>
            <StackPanel>
                <Button Style="{DynamicResource MetroCircleButtonStyle}"
                            		Height="55"
                            		Width="55"
                            		VerticalAlignment="Center" Command="{Binding ShowHomeCommand}">
                    <Rectangle Width="20" Height="20">
                        <Rectangle.Fill>
                            <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_home}"/>
                        </Rectangle.Fill>
                    </Rectangle>
                </Button>
                <Label Content="Home" HorizontalAlignment="Center"/>
            </StackPanel>
            <StackPanel>
                <Button Style="{DynamicResource MetroCircleButtonStyle}"
                            		Height="55"
                            		Width="55"
                            		VerticalAlignment="Center" Click="ReceiverButton_Click">
                    <Rectangle Width="20" Height="20">
                        <Rectangle.Fill>
                            <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_diagram}"/>
                        </Rectangle.Fill>
                    </Rectangle>
                </Button>
                <Label Content="Receiver" HorizontalAlignment="Center"/>
            </StackPanel>
            <StackPanel>
                <Button Style="{DynamicResource MetroCircleButtonStyle}"
                            		Height="55"
                            		Width="55"
                            		VerticalAlignment="Center" Click="SettingsButton_Click">
                    <Rectangle Width="20" Height="20">
                        <Rectangle.Fill>
                            <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_settings}"/>
                        </Rectangle.Fill>
                    </Rectangle>
                </Button>
                <Label Content="Settings" HorizontalAlignment="Center"/>
            </StackPanel>
            <StackPanel>
                <Button Style="{DynamicResource MetroCircleButtonStyle}"
                            		Height="55"
                            		Width="55"
                            		VerticalAlignment="Center" Command="{Binding ShowRescanCommand}">
                    <Rectangle Width="20" Height="20">
                        <Rectangle.Fill>
                            <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_network}"/>
                        </Rectangle.Fill>
                    </Rectangle>
                </Button>
                <Label Content="Rescan" HorizontalAlignment="Center" VerticalAlignment="Top"/>
            </StackPanel>
            <StackPanel Visibility="{Binding Path=ShowSendDebugCommand, Converter={StaticResource boolToVis}}">
                <Button Style="{DynamicResource MetroCircleButtonStyle}"
                            		Height="55"
                            		Width="55"
                            		VerticalAlignment="Center" Command="{Binding SendDebugCommandCommand}">
                    <Rectangle Width="20" Height="20">
                        <Rectangle.Fill>
                            <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_alert}"/>
                        </Rectangle.Fill>
                    </Rectangle>
                </Button>
                <Label Content="Send Command" HorizontalAlignment="Center" VerticalAlignment="Top"/>
            </StackPanel>
            <StackPanel>
                <Button Style="{DynamicResource MetroCircleButtonStyle}"
                            		Height="55"
                            		Width="55"
                            		VerticalAlignment="Center" Command="{Binding RESTServerCommand}">
                    <Rectangle Width="20" Height="20">
                        <Rectangle.Fill>
                            <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_share}"/>
                        </Rectangle.Fill>
                    </Rectangle>
                </Button>
                <Label Content="Server" HorizontalAlignment="Center" VerticalAlignment="Top"/>
            </StackPanel>
            <StackPanel>
                <Button Style="{DynamicResource MetroCircleButtonStyle}"
                            		Height="55"
                            		Width="55"
                            		VerticalAlignment="Center" Command="{Binding AboutCommand}">
                    <Rectangle Width="20" Height="20">
                        <Rectangle.Fill>
                            <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_information}"/>
                        </Rectangle.Fill>
                    </Rectangle>
                </Button>
                <Label Content="About" HorizontalAlignment="Center" VerticalAlignment="Top"/>
            </StackPanel>
        </StackPanel>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="227" />
                <RowDefinition Height="5" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <DockPanel x:Name="dopDisplay" Margin="3">
                <StackPanel Margin="0,2,2,0" DockPanel.Dock="Right" Orientation="Horizontal">
                    <StackPanel.Resources>
                        <Style TargetType="Button" BasedOn="{StaticResource StandardButton}">
                            <Setter Property="Margin" Value="3,3,3,0"/>
                            <Setter Property="Height" Value="40"/>
                            <Setter Property="Width" Value="50"/>
                        </Style>
                    </StackPanel.Resources>
                    <StackPanel>
                        <TextBlock Margin="0,2,0,2" Text="Volume" HorizontalAlignment="Center"/>
                        <TextBlock Margin="0,2,0,2" Text="{Binding Path=CurrentVolume, StringFormat='\{0:000}'}" HorizontalAlignment="Center" FontFamily="Arial Black"/>
                        <Separator />
                        <Button Content="Up" Command="{Binding VolumeUpCommand}"/>
                        <Button Content="Down" Command="{Binding VolumeDownCommand}"/>
                        <TextBlock Margin="0,2,0,2" Text="Mute" HorizontalAlignment="Center"/>
                        <Separator />
                        <Button Height="30"  Command="{Binding MuteToggleCommand}">
                            <Rectangle Height="25" Width="25">
                                <Rectangle.Fill>
                                    <VisualBrush x:Name="bruMute" Stretch="Fill"  Visual="{StaticResource appbar_sound_0}"/>
                                </Rectangle.Fill>
                            </Rectangle>
                        </Button>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Margin="0,2,0,2" Text="Preset" HorizontalAlignment="Center"/>
                        <TextBlock Margin="0,2,0,2" Text="{Binding Path=CurrentAudioPreset}" HorizontalAlignment="Center" FontFamily="Arial Black"/>
                        <Separator />
                        <Button Content="1" Command="{Binding AudioPresetChangeCommand}" CommandParameter="Set1"/>
                        <Button Content="2" Command="{Binding AudioPresetChangeCommand}" CommandParameter="Set2"/>
                        <Button Content="3" Command="{Binding AudioPresetChangeCommand}" CommandParameter="Set3"/>
                        <Button x:Name="cmdAudioPresetSet" Content="Set" Command="{Binding AudioPresetSetCommand}" />

                        <!--<Button x:Name="cmdAudioPresetSet" Content="Set" Click="cmdAudioPresetSet_Click"/> Background="{StaticResource BorderBrushSelected}"
                        <Popup x:Name="popAudioPresetSet" IsOpen="False" PlacementTarget="{Binding ElementName=cmdAudioPresetSet}" Placement="Left" >
                            <StackPanel Orientation="Horizontal">
                                <Button Content="Set 1" Command="{Binding AudioPresetSetCommand}" CommandParameter="Set1"/>
                                <Button Content="Set 2" Command="{Binding AudioPresetSetCommand}" CommandParameter="Set2"/>
                                <Button Content="Set 3" Command="{Binding AudioPresetSetCommand}" CommandParameter="Set3"/>
                            </StackPanel>
                        </Popup>-->
                    </StackPanel>
                </StackPanel>
                <Border Margin="0,2,3,0" Style="{StaticResource ContentBorder}">
                    <Border.Resources>
                        <Style TargetType="TextBlock">
                            <Setter Property="FontSize" Value="10" />
                            <Setter Property="FontWeight"  Value="Heavy"/>
                        </Style>
                    </Border.Resources>

                    <DockPanel LastChildFill="True">
                        <StackPanel DockPanel.Dock="Left">
                            <TextBlock Margin="2,1,0,1" Text="{Binding CurrentZoneDisplay}"/>
                            <TextBlock Margin="2,10,0,1" Text="{Binding CurrentInputSelector}"/>
                            <TextBlock Margin="2,1,0,1" Text="{Binding CurrentListeningMode}"/>
                            <TextBlock Margin="2,1,0,1" Text="{Binding CurrentNetworkServiceType}"/>
                            <TextBlock Margin="2,1,0,1" Text="{Binding Path=CurrentVolume, StringFormat='Volume: {0:000}'}"/>
                            <TextBlock Margin="2,10,0,1" Text="{Binding NetArtistName}"/>
                            <TextBlock Margin="2,1,0,1" Text="{Binding NetAlbumName}"/>
                            <TextBlock Margin="2,1,0,1" Text="{Binding NetTitleName}"/>
                            <TextBlock Margin="2,1,0,1" Text="{Binding NetTrackInfo}"/>
                            <TextBlock Margin="2,1,0,1" Text="{Binding NetTimeInfo}"/>
                            <StackPanel Orientation="Horizontal" Visibility="{Binding Path=ShowNetPlayStatus, Converter={StaticResource boolToVis}}">
                                <StackPanel.Resources>
                                    <Style TargetType="Rectangle">
                                        <Setter Property="Margin" Value="2,1,2,1"/>
                                        <Setter Property="Height" Value="15" />
                                        <Setter Property="Width" Value="15" />
                                    </Style>
                                </StackPanel.Resources>
                                <Rectangle Visibility="{Binding Path=PlayStatus, ConverterParameter=PLAY, Converter={StaticResource enumToVis}}">
                                    <Rectangle.Fill>
                                        <VisualBrush Stretch="Fill"  Visual="{StaticResource appbar_play}"/>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle Visibility="{Binding Path=PlayStatus, ConverterParameter=PAUSE, Converter={StaticResource enumToVis}}">
                                    <Rectangle.Fill>
                                        <VisualBrush Stretch="Fill"  Visual="{StaticResource appbar_pause}"/>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle Visibility="{Binding Path=PlayStatus, ConverterParameter=STOP, Converter={StaticResource enumToVis}}">
                                    <Rectangle.Fill>
                                        <SolidColorBrush Color="{DynamicResource BlackColor}" />
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle Visibility="{Binding Path=PlayStatus, ConverterParameter=FR, Converter={StaticResource enumToVis}}">
                                    <Rectangle.Fill>
                                        <VisualBrush Stretch="Fill"  Visual="{StaticResource appbar_rewind}"/>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle Visibility="{Binding Path=PlayStatus, ConverterParameter=FF, Converter={StaticResource enumToVis}}">
                                    <Rectangle.Fill>
                                        <VisualBrush Stretch="Fill"  Visual="{StaticResource appbar_fastforward}"/>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle Visibility="{Binding Path=RepeatStatus, ConverterParameter=OFF, Converter={StaticResource enumToInvis}}">
                                    <Rectangle.Fill>
                                        <VisualBrush Stretch="Fill"  Visual="{StaticResource appbar_repeat}"/>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle Visibility="{Binding Path=ShuffleStatus, ConverterParameter=OFF, Converter={StaticResource enumToInvis}}">
                                    <Rectangle.Fill>
                                        <VisualBrush Stretch="Fill"  Visual="{StaticResource appbar_shuffle}"/>
                                    </Rectangle.Fill>
                                </Rectangle>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Visibility="{Binding Path=ShowSearching, Converter={StaticResource boolToVis}}" Margin="2,1,0,1">
                                <Ellipse Fill="Red" Width="15" Height="15">
                                    <Ellipse.Triggers>
                                        <EventTrigger RoutedEvent="Ellipse.Loaded">
                                            <EventTrigger.Actions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <DoubleAnimation Storyboard.TargetProperty="(Ellipse.Opacity)" RepeatBehavior="Forever"
                                                            From="0.8" To="0.2" Duration="0:0:2" AutoReverse="True"  />
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger.Actions>
                                        </EventTrigger>
                                    </Ellipse.Triggers>
                                </Ellipse>
                                <TextBlock Text="Searching"></TextBlock>
                            </StackPanel>
                        </StackPanel>
                        <Border Margin="5" Style="{StaticResource ContentBorder}" Visibility="{Binding Path=ShowNetItems, Converter={StaticResource boolToVis}}">
                            <Border.Resources>
                                <Style TargetType="DataGrid">
                                    <Setter Property="CellStyle">
                                        <Setter.Value>
                                            <Style TargetType="DataGridCell">
                                                <Style.Triggers>
                                                    <Trigger Property="IsSelected" Value="True">
                                                        <Setter Property="Background">
                                                            <Setter.Value>
                                                                <SolidColorBrush Color="{DynamicResource AccentColor2}" />
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Setter Property="BorderBrush" Value="#FF143c65" />
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Border.Resources>
                            <DockPanel LastChildFill="True">
                                <DockPanel DockPanel.Dock="Right">
                                    <Button DockPanel.Dock="Top" Style="{DynamicResource MetroCircleButtonStyle}"
                                        Height="30"
                            		    Width="30"                        
                            		    VerticalAlignment="Top"
                                        Command="{Binding Path=NetTuneCommand}"
                                        CommandParameter="LEFT">
                                        <Rectangle Width="10" Height="10">
                                            <Rectangle.Fill>
                                                <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_arrow_up}"/>
                                            </Rectangle.Fill>
                                        </Rectangle>
                                    </Button>
                                    <Button DockPanel.Dock="Bottom" Style="{DynamicResource MetroCircleButtonStyle}"
                                        Height="30"
                            		    Width="30"                        
                            		    VerticalAlignment="Bottom"
                                        Command="{Binding Path=NetTuneCommand}"
                                        CommandParameter="RIGHT">
                                        <Rectangle Width="10" Height="10">
                                            <Rectangle.Fill>
                                                <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_arrow_down}"/>
                                            </Rectangle.Fill>
                                        </Rectangle>
                                    </Button>
                                </DockPanel>
                                <DataGrid AutoGenerateColumns="False" CanUserAddRows="False" HeadersVisibility="None" Background="Transparent" BorderThickness="0"
                              SelectionMode="Single"
                              ItemsSource="{Binding NetItemList}"  
                              SelectedItem="{Binding SelectedNetItem}"
                              MouseDoubleClick="DataGrid_MouseDoubleClick">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn Visibility="Hidden" Width="*" Header="Line" IsReadOnly="True" Binding="{Binding Path=Line}"/>
                                        <DataGridTextColumn Width="*" Header="Name" IsReadOnly="True" Binding="{Binding Path=Name}"/>
                                    </DataGrid.Columns>
                                </DataGrid>
                            </DockPanel>
                        </Border>

                        <Grid Name="grdImageAlbum" Margin="30" Visibility="Collapsed">
                            <Image x:Name="imgAlbum"
                               HorizontalAlignment="Center" Stretch="Fill" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
                                <Image.Width>
                                    <MultiBinding Converter="{StaticResource squareConverter}">
                                        <MultiBinding.Bindings>
                                            <Binding ElementName="grdImageAlbum" Path="ActualWidth" />
                                            <Binding ElementName="grdImageAlbum" Path="ActualHeight" />
                                        </MultiBinding.Bindings>
                                    </MultiBinding>
                                </Image.Width>
                                <Image.Height>
                                    <MultiBinding Converter="{StaticResource squareConverter}">
                                        <MultiBinding.Bindings>
                                            <Binding ElementName="grdImageAlbum" Path="ActualWidth" />
                                            <Binding ElementName="grdImageAlbum" Path="ActualHeight" />
                                        </MultiBinding.Bindings>
                                    </MultiBinding>
                                </Image.Height>
                                <Image.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Image.RenderTransform>
                            </Image>
                        </Grid>

                    </DockPanel>
                </Border>

            </DockPanel>
            <GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" />
            <TabControl x:Name="tabControl" Margin="3"  SelectedIndex="{Binding SelectedTabIndex}" Grid.Row="2">
                <TabControl.ItemContainerStyle>
                    <Style TargetType="{x:Type TabItem}">
                        <Style.Setters>
                            <Setter Property="Visibility" Value="Collapsed" />
                        </Style.Setters>
                    </Style>
                </TabControl.ItemContainerStyle>
                <TabItem x:Name="tabHome" Header="Home" TabIndex="0" BorderThickness="0">
                    <my:HomeUserControl />
                </TabItem>
                <TabItem x:Name="tabNet" Header="Net" TabIndex="1" BorderThickness="0">
                    <my:NetUserControl />
                </TabItem>
            </TabControl>
        </Grid>
        <!--<DockPanel.Triggers>
            <EventTrigger RoutedEvent="Button.Click" SourceName="btnTest">
                <BeginStoryboard Storyboard="{StaticResource AlbumImageStoryboard}"/>
            </EventTrigger>
        </DockPanel.Triggers>-->
    </DockPanel>
</Controls:MetroWindow>
